<?php namespace Admin\Controller; 

use Hdphp\Controller\Controller;

use Admin\Model\User;

class LoginController extends Controller{

    public function login()
    {
       View::make();
    }

    public function doLogin()
    {
    	$user= new User;
    	if($user->login())
    	{
    		go('Index/index');
    	}
    	else
    	{
    		$this->error($user->getError());
    	}
    }

    public function code()
    {
    	Code::make();
   	}

   	public function out()
   	{
   		session_unset();
   		session_destroy();
   		go('login');
   	}
}
